package org.sen.action;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.sen.bean.ComentBean;
import org.sen.utils.PublicUtils;

/**
 * Servlet implementation class SaveComcontent
 */
@WebServlet("/SaveComcontent")
public class SaveComcontent extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * 客户评论处理
	 */
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		ComentBean adminB = PublicUtils.convertFormData2Bean(request,ComentBean.class);
		int i = PublicUtils.getInstance(org.sen.service.impl.LoginServiceImpl.class).saveOrUpdateUserreview(adminB);
		if(i>0) {
			// 保存成功
			response.sendRedirect("comment/successcomment.html");
		}else {
			// 保存失败
			response.sendRedirect("comment/addcomment.jsp");
		}
	}

}
